import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: 'IP地址',
    align: 'center',
    dataIndex: 'ipAddress',
  },
  {
    title: '是否启用',
    align: 'center',
    dataIndex: 'enable_dictText',
  },
  {
    title: '初次登录用户',
    align: 'center',
    dataIndex: 'username_dictText',
  },
  {
    title: '登录时间',
    align: 'center',
    dataIndex: 'createTime',
  },
  {
    title: '说明',
    align: 'center',
    dataIndex: 'note',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: 'IP地址',
    field: 'ipAddress',
    component: 'Input',
    rules: [{ required: true, validator: rules.ipverify, trigger: 'blur' }],
  },
  {
    label: '是否启用',
    field: 'enable',
    component: 'JDictSelectTag',
    componentProps: {
      stringToNumber: true,
      dictCode: 'yn',
      type: 'radioButton',
    },
    rules: [{ required: false, trigger: 'blur' }],
  },
  {
    label: '说明',
    field: 'note',
    component: 'Input',
    rules: [{ required: false, trigger: 'blur' }],
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  ipAddress: { title: 'IP地址', order: 0, view: 'text', type: 'string' },
  enable: { title: '是否启用', order: 0, view: 'number', type: 'number', dictCode: 'yn' },
  username: { title: '初次登录用户账号', order: 0, view: 'text', type: 'string' },
  note: { title: '说明', order: 1, view: 'text', type: 'string' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
